package org.apache.harmony.javax.security.auth.callback;

import java.io.Serializable;
import java.util.Arrays;

public class PasswordCallback
  implements Serializable, Callback
{
  private static final long serialVersionUID = 2267422647454909926L;
  private String prompt;
  boolean echoOn;
  private char[] inputPassword;

  private void setPrompt(String paramString)
    throws IllegalArgumentException
  {
    if ((paramString == null) || (paramString.length() == 0))
      throw new IllegalArgumentException("auth.14");
    this.prompt = paramString;
  }

  public PasswordCallback(String paramString, boolean paramBoolean)
  {
    setPrompt(paramString);
    this.echoOn = paramBoolean;
  }

  public String getPrompt()
  {
    return this.prompt;
  }

  public boolean isEchoOn()
  {
    return this.echoOn;
  }

  public void setPassword(char[] paramArrayOfChar)
  {
    if (paramArrayOfChar == null)
    {
      this.inputPassword = paramArrayOfChar;
    }
    else
    {
      this.inputPassword = new char[paramArrayOfChar.length];
      System.arraycopy(paramArrayOfChar, 0, this.inputPassword, 0, this.inputPassword.length);
    }
  }

  public char[] getPassword()
  {
    if (this.inputPassword != null)
    {
      char[] arrayOfChar = new char[this.inputPassword.length];
      System.arraycopy(this.inputPassword, 0, arrayOfChar, 0, arrayOfChar.length);
      return arrayOfChar;
    }
    return null;
  }

  public void clearPassword()
  {
    if (this.inputPassword != null)
      Arrays.fill(this.inputPassword, '\000');
  }
}

/* Location:           D:\hygieia\userclient\common\libs\easemobchat_2.1.8.jar
 * Qualified Name:     org.apache.harmony.javax.security.auth.callback.PasswordCallback
 * JD-Core Version:    0.6.1
 */